import 'package:flutter/material.dart';
import 'package:flutter_syt/domain/widgets/network_load_image.dart';
import 'package:flutter_syt/utils/global_date_time_format.dart';

class FlowVideoItemEntity {
  String url;
  String title;
  String auth;
  int time;

  FlowVideoItemEntity(this.url, this.title, this.auth, this.time);
}

class FlowVideoItem extends StatelessWidget {
  FlowVideoItemEntity _entity;

  FlowVideoItem(this._entity);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Stack(
            children: [
              ClipRRect(
                borderRadius: BorderRadius.all(Radius.circular(8)),
                child: AspectRatio(
                  aspectRatio: 1.78,
                  child:
                      // CachedNetworkImage(
                      // imageUrl:
                      NetworkLoadImage.loadNetworkImage(
                    _entity.url,
                  ),
                ),
              ),
              Positioned.fill(
                child: Center(
                  child: Image.asset("assets/icons/flow_play.png"),
                ),
              ),
            ],
          ),
          Text(
            _entity.title,
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            style: TextStyle(
              fontSize: 16,
              color: Colors.black.withOpacity(0.8),
            ),
          ),
          Row(
            children: [
              Container(
                color: Color(0xffFFF5E7),
                padding: EdgeInsets.symmetric(vertical: 4, horizontal: 10),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(8)),
                ),
                child: Text(
                  _entity.auth,
                  style: TextStyle(fontSize: 10, color: Color(0xffE8692B)),
                ),
              ),
              Spacer(),
              Text(
                formatDate(_entity.time),
                style: TextStyle(
                    color: Colors.black.withOpacity(0.4), fontSize: 11),
              ),
            ],
          )
        ],
      ),
    );
  }
}
